const zlib = require('zlib');
const gunzip = zlib.createGunzip();
const fs = require('fs');
const fsin = fs.createReadStream('input.txt.gz');
const fsout = fs.createWriteStream('inputcp.txt');
fsin.pipe(gunzip).pipe(fsout);
let arr = new Array();
let barr = new Array();
fsin.on('data',(chunk)=>{
	console.log(chunk)
	arr.push(chunk);
	zlib.gunzip(chunk,(err,buf)=>{
		console.log('------'+buf.toString()+'---');
	})
});
fsin.on('end',()=>{
	console.log('-----end---')
});
